/*** In The Name of Allah ***/
package com.codeanalysissys.backend.python;

/**
 * A simple structure for storing key information about a Python class field.
 * 
 * @author WenLiang Peng
 */
public class PythonField {

	public final String NAME;
	public final String tarGet;
	public final String SPECIFIER;

	public PythonField(String specifier, String tarGet, String name) {
		NAME = name;
		this.tarGet = tarGet;
		SPECIFIER = specifier == null ? "" : specifier;
	}

	@Override
	public String toString() {
		String specifier = SPECIFIER == "" ? "null" : SPECIFIER;
		StringBuilder str = new StringBuilder();
		str.append("{ SPECIFIER : \"").append(specifier).append("\", ");
		str.append("TARGET : \"").append(tarGet).append("\", ");
		str.append("NAME : \"").append(NAME).append("\" }");
		return str.toString();
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof PythonField))
			return false;
		PythonField f = (PythonField) obj;
		return (NAME.equals(f.NAME) && tarGet.equals(f.tarGet));
	}
}
